package com.tianji.promotion.strategy.impl;

import com.tianji.common.autoconfigure.redisson.annotations.Lock;
import com.tianji.promotion.strategy.MyLockStrategy;
import org.redisson.api.RLock;
import org.springframework.stereotype.Component;

@Component
public class SkipFast implements MyLockStrategy {
    /**
     * 不重试，直接结束，返回false
     */
    @Override
    public boolean tryLock(RLock lock, Lock properties) throws InterruptedException {
        return lock.tryLock(0, properties.leaseTime(), properties.timeUnit());
    }
}
